import 'package:flutter_common_fragement/common/utils/index.dart';

mixin EventBusMixin {
  bool _isDispose = false;

  void setIsDispose(bool isDispose) {
    _isDispose = isDispose;
  }

  void sendEvent(dynamic event) {
    if (!_isDispose) {
      EventBusUtil().fire(event);
    }
  }

  void listenEvent<T>(void Function(T) callback) {
    EventBusUtil().listen(callback);
  }

  void destroyEvent() {
    EventBusUtil().destroy();
  }
}
